FROM centos:7

MAINTAINER le5le.com

ENV ROOT_PATH /usr/local

WORKDIR $ROOT_PATH

ADD java-17-openjdk-17.0.8.0.7-1.portable.jdk.el.x86_64.tar.xz $ROOT_PATH
ADD apache-tomcat-10.1.11.tar.gz $ROOT_PATH

ENV TIME_ZONE Asia/Shanghai

RUN ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone

ENV JAVA_HOME /usr/local/java-17-openjdk-17.0.8.0.7-1.portable.jdk.el.x86_64
ENV CLASSPATH .:$JAVA_HOME/lib
ENV CATALINA_HOME /usr/local/apache-tomcat-10.1.11
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin

EXPOSE 8080

ENTRYPOINT ["catalina.sh", "run"]

# 构建镜像
# docker build -t le5le/tomcat:10.1.11-jdk17-openjdk .

# 运行容器
# docker run --name appServer -p 8080:8080 \
#            -v /usr/local/apache-tomcat-10.1.11/conf/server.xml:/usr/local/apache-tomcat-10.1.11/conf/server.xml \
#            -v /usr/local/apache-tomcat-10.1.11/webapps:/usr/local/apache-tomcat-10.1.11/webapps \
#            -v /usr/local/apache-tomcat-10.1.11/logs:/usr/local/apache-tomcat-10.1.11/logs \
#            -v /var/meta/share:/var/meta/share \
#            -v /var/opt/meta/webapp/logs:/var/opt/meta/webapp/logs \
#            le5le/tomcat:10.1.11-jdk17-openjdk

# 执行命令
# docker exec -it appServer /bin/bash

